//-----------------------------------------------------------------------
// <copyright file="GalleryService.cs" company="FetCo">
//     Copyright (c) FetCo. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------	

using System;
using System.Collections;
using FetCo.Framework;
using ADESSA.Entities;
using ADESSA.Data;
    
namespace ADESSA.Business
{   
	/// <summary>
	/// 
	/// </summary> 
    public class GalleryService
    {
        #region Gallery

        public static void CreateGallery(Gallery gallery)
        {            
            try
            {
                GalleryDAO galleryDAO = new GalleryDAO();
                galleryDAO.CreateGallery(gallery);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessCreateGalleryException, ex);
            }
        }        

        public static void UpdateGallery(Gallery gallery)
        {            
            try
            {
                GalleryDAO galleryDAO = new GalleryDAO();
                galleryDAO.UpdateGallery(gallery);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessUpdateGalleryException, ex);
            }
        }        

        public static void DeleteGallery(long galleryId)
        {            
            try
            {
                GalleryDAO galleryDAO = new GalleryDAO();
                galleryDAO.DeleteGallery(galleryId);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessDeleteGalleryException, ex);
            }
        }
        
        public static Gallery GetGallery(long galleryId)
        {            
            try
            {
                GalleryDAO galleryDAO = new GalleryDAO();
                return galleryDAO.GetGallery(galleryId);                
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetGalleryException, ex);
            }
        }                

        public static GalleryCollection GetGalleryList(GalleryColumns orderBy, OrderDirection orderDirection)
        {            
            try
            {
                GalleryDAO galleryDAO = new GalleryDAO();
                return galleryDAO.GetGalleryList(orderBy, orderDirection);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetGalleryListException, ex);
            }
        }        

        public static GalleryCollection GetGalleryList(GalleryColumns orderBy, OrderDirection orderDirection, int page, int pageSize, out int totalRecords)
        {            
            try
            {
                GalleryDAO galleryDAO = new GalleryDAO();
                return galleryDAO.GetGalleryList(orderBy, orderDirection, page, pageSize, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetGalleryListException, ex);
            }
        }        

	    public static GalleryCollection GetGalleryListByParam(object orderBy, OrderDirection orderDirection,string where)
        {            
            try
            {
                GalleryDAO galleryDAO = new GalleryDAO();
                return galleryDAO.GetGalleryListByParam(orderBy, orderDirection,where);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetGalleryListException, ex);
            }
        }        

        public static GalleryCollection GetGalleryListByParam(object orderBy, OrderDirection orderDirection, int page, int pageSize,string Criteria, out int totalRecords)
        {            
            try
            {
                GalleryDAO galleryDAO = new GalleryDAO();
                return galleryDAO.GetGalleryListByParam(orderBy, orderDirection, page, pageSize,Criteria, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetGalleryListException, ex);
            }
        }        

        #endregion
    }
}